import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src',
                import.meta.url))
        }
    },
    // server: {
    //   proxy: {
    //     '/my': {
    //       // target: 'http://192.168.19.1:8080', // 设置代理的目标地址
    //       target: 'http://192.168.43.104:8080', // 设置代理的目标地址
    //       // target: 'http://10.65.45.144:8080', // 设置代理的目标地址
    //       // changeOrigin: true,
    //       rewrite: (path) => path.replace(/^\/api/, '') // 重写请求路径，将/api前缀移除
    //     }
    //   }
    // }
})